package com.caesar.IoStream;

import org.junit.jupiter.api.Test;

import java.io.*;

/**
 * @author caesar
 * @date 2025/7/14
 * @Description:
 * @apiNote
 */
public class exer4 {
    @Test
    public void test01() throws FileNotFoundException, IOException {
        Message msg = new Message("柴老师", "佟老师", "加工资", System.currentTimeMillis());
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("message.dat"));
        oos.writeObject(msg);
        oos.close();
    }
    @Test
    public void test02() throws FileNotFoundException, IOException, ClassNotFoundException{
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("message.dat"));
        Object msg = ois.readObject();
        System.out.println(msg);
        ois.close();
    }
}
